import { EntitySchema } from '@mikro-orm/core';

export class LeTask {
  id!: string;
  name?: string;
  keyword?: string;
  formula?: string;
  icon?: string;
  type?: string;
  total?: string;
  acquire?: string;
  maximum?: string;
  remark?: string;
  url?: string;
  status?: boolean = false;
  extend?: string;
  isDeleted?: number = 0;
  createdTime?: number = 0;
  updatedTime?: number = 0;
  deletedTime?: number = 0;
  prompt?: string;
  extra?: string;
  pageTips?: string;
}

export const LeTaskSchema = new EntitySchema({
  class: LeTask,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    name: { type: 'string', length: 255, nullable: true },
    keyword: { type: 'string', length: 255, nullable: true },
    formula: { type: 'string', length: 255, nullable: true },
    icon: { type: 'string', length: 255, nullable: true },
    type: { type: 'string', length: 3, nullable: true, default: 'add' },
    total: { type: 'string', length: 10, nullable: true, default: '1' },
    acquire: { type: 'string', columnType: 'bigint', nullable: true, defaultRaw: `1` },
    maximum: { type: 'string', columnType: 'bigint', nullable: true, defaultRaw: `1` },
    remark: { type: 'string', length: 255, nullable: true },
    url: { type: 'string', length: 255, nullable: true },
    status: { type: 'boolean', nullable: true, default: false },
    extend: { type: 'string', columnType: 'text', nullable: true },
    isDeleted: { type: 'number', columnType: 'tinyint', nullable: true, default: 0 },
    createdTime: { type: 'number', nullable: true, default: 0 },
    updatedTime: { type: 'number', nullable: true, default: 0 },
    deletedTime: { type: 'number', nullable: true, default: 0 },
    prompt: { type: 'string', length: 255, nullable: true },
    extra: { type: 'string', length: 255, nullable: true },
    pageTips: { type: 'string', length: 255, nullable: true },
  },
});
